package my.design.command;

/**
 * @author zp
 * @version 1.0
 * @description: 电灯关闭命令类
 * @date 2022/10/20 18:57
 */
public class LightOffCommand implements Command {
    //聚合LightReceiver
    private final IElectric IElectric;

    //构造器
    public LightOffCommand(IElectric IElectric) {
        this.IElectric = IElectric;
    }

    @Override
    public void execute() {
        //调用接收者的方法
        IElectric.off();
    }

    @Override
    public void undo() {
        //调用接收者的方法
        IElectric.on();
    }
}
